﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.ServiceProcess;
using System.Threading.Tasks;

namespace PC.Client
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : System.Configuration.Install.Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }

        public override void Commit(IDictionary savedState)
        {
            base.Commit(savedState);

            ServiceController serviceController = new ServiceController(serviceInstaller1.ServiceName);
            if (serviceController.Status == ServiceControllerStatus.Stopped) 
            {
                serviceController.Start();
                serviceController.Refresh(); //刷新重启
            }
        }

    }
}
